<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [66, 33, 88, 44];
        arr.sort(function (a, b) {
            return b - a;
        })
        var data = [
            { name: '赵六', age: 29, num: 3, score: 91 },
            { name: '李四', age: 24, num: 1, score: 93 },
            { name: '王五', age: 21, num: 5, score: 96 },
            { name: '钱八', age: 26, num: 4, score: 97 },
            { name: '张三', age: 22, num: 2, score: 99 }
        ];

        data.sort(function (o1, o2) {
            var n1 = o1.age;
            var n2 = o2.age;
            if (n1 > n2) {
                return -1;
            } else if (n1 < n2) {
                return 1;
            } else {
                return 0;
            }
        })

    </script>
</body>

</html>